self.onmessage = function (event) {

    var num = event.data;
    setInterval(function () {
        num--;
        self.postMessage(num);
    },1000)

};